import { Injectable } from '@nestjs/common';
import { InjectModel } from '@nestjs/mongoose';

@Injectable()
export class UserTempService {
    constructor(@InjectModel('UserTemp') private readonly userTempModel) {}
    async find(where = {}, sort = { sort: 1, createdTime: -1 }, fields = null) {
        return await this.userTempModel.find(where, fields).sort(sort);
    }
    async create(userTempInfo) {
        return await this.userTempModel.create(userTempInfo);
    }
    async update(userTempInfo) {
        return await this.userTempModel.updateOne({ _id: userTempInfo._id }, userTempInfo);
    }
    async delete(userTempInfo) {
        return await this.userTempModel.deleteOne(userTempInfo);
    }
}
